package zx.x.modules.yshbms.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;
import zx.x.modules.yshapp.entity.CommunityBulletinEntity;
import zx.x.modules.yshapp.entity.InvitationCodeEntity;
import zx.x.modules.yshbms.service.CommunityBulletinService;
import zx.x.modules.yshbms.service.InvitationCodeService;

import java.util.Date;
import java.util.Map;


/**
 *邀请码
 */
@RestController
@RequestMapping("yshbms/invitationCode")
public class InvitationCodeController {
    @Autowired
    private InvitationCodeService invitationCodeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = invitationCodeService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		InvitationCodeEntity invitationCodeEntity = invitationCodeService.getById(id);
        return R.ok().put("invitationCodeEntity", invitationCodeEntity);
    }


    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody InvitationCodeEntity invitationCodeEntity){
        invitationCodeEntity.setUpdateTime(new Date());
        invitationCodeService.updateById(invitationCodeEntity);
        return R.ok();
    }


}
